package SwingWorkers;

import GUIClient.GUIExtraFunctions;
import GUIClient.GUIOperationInProgress;
import java.io.BufferedReader;
import java.io.PrintWriter;
import javax.swing.SwingWorker;
import javax.swing.event.TreeExpansionEvent;

public class SwingWorkerExpandTree extends SwingWorker<Boolean, Void> {

    GUIOperationInProgress progress = new GUIOperationInProgress();
    TreeExpansionEvent event;
    BufferedReader in;
    PrintWriter out;
    boolean server;

    public SwingWorkerExpandTree(TreeExpansionEvent evt, boolean isServer,
            BufferedReader input, PrintWriter output) {
        event = evt;
        server = isServer;
        in = input;
        out = output;
    }

    @Override
    protected Boolean doInBackground() throws Exception {
        progress.setVisible(true);
        GUIExtraFunctions.treeExpanded(event, server, in, out);
        progress.setVisible(false);
        return true;
    }
}
